package com.khalil.kkadmin.cms.domain;

import com.khalil.kkadmin.infrastructure.jpa.domain.EntityBase;
import com.khalil.kkadmin.infrastructure.jpa.domain.TreeEntityBase;
import jakarta.persistence.*;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

@Table(name = "cms_content")
@EntityListeners(AuditingEntityListener.class)
@Entity
@EqualsAndHashCode(callSuper = true)
@Data
public class CmsContent extends EntityBase<Long> {
    // 标题
    private String title;

    // 栏目ID
    @Column
    private Long columnId;

    @Transient
    private CmsColumn column;

    @Enumerated(EnumType.STRING)
    private ContentType contentType;
    // 内容
    @Column(columnDefinition = "text")
    private String content;

    // 是否置顶
    @Column(columnDefinition = "boolean default false")
    private Boolean topFlag;

    @Enumerated(EnumType.STRING)
    private ContentStatus status;

    enum ContentType {
        HTML,
        MARKDOWN,
        FILE,
    }

    enum ContentStatus {
        DRAFT,
        PUBLISHED,
        DELETED
    }
}
